package com.gp.testonline.service.impl;

import com.gp.testonline.dao.ExamanswerMapper;
import com.gp.testonline.eo.ExamanswerEOPage;
import com.gp.testonline.model.Examanswer;
import com.gp.testonline.service.ExamanswerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/*
 *实现业务及流程接口当中的内容
 */
@Service
public class ExamanswerServiceImpl implements ExamanswerService {
    @Autowired
    private ExamanswerMapper examanswerMapper;

    @Override
    public int InsertExamanswer(Examanswer examanswer) {
        int isInsert=0;
        /*1 没有相关业务流程的判断*/
        try{
            isInsert=examanswerMapper.insertExamanswer(examanswer);
        }catch (Exception e){
            isInsert=-1;
            //打印时报错的情况
            System.out.println("添加试卷答题信息时执行sql报错的原因为："+e.getMessage());
        }
        return isInsert;
    }

    @Override
    public List<ExamanswerEOPage> getExamanswerAll(ExamanswerEOPage examanswerEOPage) {
        List<ExamanswerEOPage> listExamanswerEo=examanswerMapper.getExamanswerAll(examanswerEOPage);
        return listExamanswerEo;
    }
}
